<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix="c" uri="/WEB-INF/tld/c.tld"%>
<!DOCTYPE HTML>
<html>
<head>
    <title>角色管理</title>
    <meta charset="UTF-8">
    <base href="<%=basePath%>">
    <link rel="stylesheet" type="text/css" href="css/page.css" />
    <link rel="stylesheet" type="text/css" href="js/bootstrap/css/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="js/bootstrap/css/bootstrap-responsive.css" />
    <link rel="stylesheet" type="text/css" href="js/bootstrap/css/style.css" />
     <style type="text/css">
        body {
            padding-bottom: 40px;
        }
        .sidebar-nav {
            padding: 9px 0;
        }

        @media (max-width: 980px) {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }
        .mouseover:hover{cursor:hand;color:#0000FF}
    </style>
   <script type="text/javascript" src="js/jquery.1.7.2.js"></script>
	<script src="js/spring.pager.js"></script>
    <script type="text/javascript" src="js/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript">
    	function  UpdateData(rid){
    		var id="";
    		var tb = document.getElementById("tab");
    		var box=tb.getElementsByTagName('input');
    		for(var i=0;i<box.length;i++){
    			if(box[i].type=='checkbox' && box[i].checked){
    				id=id+box[i].value+":";
    			}
    		}
    		$.post("user/updateRoleAuthority.do?id="+id+"&rid="+rid,function (a,b){
				if(b=='success'){
					alert(b);
					self.opener=null;
					self.close();
				}else{
					alert(b);
				}
			});	
		};
    </script>
    
</head>
<body >
  	角色名称：${role.name}</br>
  	已有权限：</br>
	<c:forEach items="${returnInfo}" var="nsVar" varStatus = "status">
				${nsVar.authorityId}/
	</c:forEach>
	<table class="table table-bordered table-hover definewidth m10" id="tab">
		<c:forEach items="${authorityListYes}" var="authority" varStatus = "status">
			<tr>
				<td>
					<input type="checkbox" name="authorityBox" id="authorityBox" value="${authority.id}"
					checked="checked"
					/>
				</td>
				<td>${authority.id}</td>
				<td>${authority.name}</td>
				<td>${authority.type}</td>
				<td>${authority.url}</td>
				<td>${authority.parentId}</td>
			</tr>
		</c:forEach>
		<c:forEach items="${authorityListNo}" var="authority" varStatus = "status">
			<tr>
				<td>
					<input type="checkbox" name="authorityBox" id="authorityBox" value="${authority.id}"
					/>
				</td>
				<td>${authority.id}</td>
				<td>${authority.name}</td>
				<td>${authority.type}</td>
				<td>${authority.url}</td>
				<td>${authority.parentId}</td>
			</tr>
		</c:forEach>
	</table>
		<input type="button" class="btn btn-primary" id="submit"
					value="提交" onclick="UpdateData('${role.id}');" />
		<button type="button" class="btn" onclick="frameElement.api.close();">关闭</button>
					
</body>
</html>